#include <iostream>
using namespace std;
/*
8、Dynamically create an array of objects of class Counted (from Exercise 1). Call delete for the resulting pointer, without the square brackets. Explain the results.
*/

class Counted{
public:
	int id;
	static int count;
	
	Counted():id(count++){
		cout << "the object of Counted is being created and the id = " << id << endl;
	}
	
	~Counted(){
		cout << "the object of Counted is being destroyed and the id = " << id << endl;
	}
};

int Counted::count = 1;


int main(int argc, char *argv[]) {
	
	//create and destroy an array
	Counted *arr = new Counted[5];
	delete[] arr;
	
}